<%--
  Created by IntelliJ IDEA.
  User: liliting
  Date: 2020/10/9
  Time: 下午4:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="css/style.css">
    <script src="/js/main.js"></script>
    <script type="text/javascript" src="/js/jquery-2.2.4.js"></script>
    <script type="text/javascript">

       $(function(){

           $("#btn").click(function(){

               var data = {id:$("#id").val(),username:$("#name").val(),
                   birthdate:$("#birthdate").val()};

               $.ajax({
                   url:"/addUser",
                   type:"POST",
                   data:JSON.stringify(data),//json对象   转  json字符串
                   contentType:'application/json',
                   dataType:"json",
                   success:function(data){
                       console.log( data);
                   }
               });


           });

       });


    </script>

</head>
<body>

  <form action="/first/getParam2" method="post">
      <input type="text" name="id" id="id"><br>
      <input type="text" name="name"  id="name"><br>
      <input type="text" name="birthdate" id="birthdate" ><br>
      <input type="checkbox" name="hobby" value="足球" >足球
      <input type="checkbox" name="hobby" value="篮球" >篮球
      <input type="checkbox" name="hobby" value="排球" >排球<br>
      <input type="button" value="提交" id="btn">
  </form>


</body>
</html>
